package com.linzelin.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class MVCConfig implements WebMvcConfigurer {

    /**
     * 视图跳转解析器
     *
     * @param registry
     */
    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        //这里就可以设置对应的视图跳转了
        registry.addViewController("/error/403").setViewName("403");
        registry.addViewController("/error").setViewName("500");
        //其他的访问都跳转到500
    }
}